{include file="public/header" /}
<body class="hide-top">
<div class="earnings-container">
    <img src="/static/index/img/icon37.png" class="bg" alt="">
    <div class="earnings-content">
        <div class="earnings-hd flex-center">
            <i class="layui-icon layui-icon-left flex-center" onclick="history.go(-1)"></i>邀请中心
        </div>
    </div>
    <div class="share-content bgc">
        <div class="news">
            <p class="flex-center">
                <img src="{if $user.photo}{$user.photo}{else}cache('system')['default_photo']{/if}" alt="">
            </p>
            <p style="padding-top: 10px;font-size: 1.5rem;font-weight: bold">{$user.code}</p>
        </div>
        <p class="flex-center code QRcode"></p>
        <p>扫描二维码加入我的团队</p>
        <input type="hidden" id="copy" value="{$url}"/>
        <p class="save copy" data-clipboard-target="#copy">复制链接</p>
    </div>
</div>
</body>
{include file="public/footer"/}
<script src="/static/index/js/qrcode.min.js"></script>
<script src="/static/index/js/clipboard.min.js"></script>
<script src="/static/index/js/utf.js"></script>
<script>
    $(".QRcode").qrcode({
        render: "canvas", //设置渲染方式，有table和canvas
        text: '{$url}', //扫描二维码后自动跳向该链接
        width: "240", //二维码的宽度
        height: "240", //二维码的高度
        background: "#ffffff", //二维码的后景色
        foreground: "#000000", //二维码的前景色
        //src: 'images/logo.png', //二维码中间的图片
    });
    $('.copy').click(function () {
        var clipboard = new ClipboardJS('.copy',{
            text: function() {
                return $("#copy").val();
            }
        });
        clipboard.on("success", function (e) {
            e.clearSelection();
            layer.msg('复制成功')
        });
        clipboard.on("error", function (e) {
            layer.msg('复制失败')
        });
    })
</script>
</html>